
export default {
    namespaced:true,
    state:{
       books:[
        {
            id:"01001",
            name:"三国演义",
            author:"罗贯中"
        },
        {
            id:"01002",
            name:"西厢记",
            author:"李晨光"
        }
       ] 
    },
    getters:{
        bookCount:function(state){
            return state.books.length;
        }
    },
    mutations:{
        mAddBook(state,payload){
            state.books.push(payload.data);
        }
    }
}